package com.quiz.bis.controller;

import com.quiz.common.core.domain.R;
import com.quiz.bis.domain.vo.ExamGroupDetailVo;
import com.quiz.bis.service.IExamGroupDetailService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/exam/group/detail")
@Tag(name = "考试组详情管理")
@RequiredArgsConstructor
public class ExamGroupDetailController {
    private final IExamGroupDetailService detailService;

    /**
     * 获取考试组详情（老师端）
     * @param groupId
     * @return
     */
    @GetMapping("/{groupId}")
    public R<ExamGroupDetailVo> getDetail(@PathVariable Long groupId) {
        return detailService.getGroupDetail(groupId);
    }

    /**
     * 获取考试组详情（学生端）
     * @param groupId
     * @return
     */
    @GetMapping("/student/{groupId}")
    public R<ExamGroupDetailVo> getDetailOfStudent(@PathVariable Long groupId) {
        R<ExamGroupDetailVo> groupDetail = detailService.getGroupDetail(groupId);
        ExamGroupDetailVo data = groupDetail.getData();
        data.setActivities(null);
        data.setMembers(null);
        return groupDetail;
    }
}